<template>
  <div class="son3">
    实时修改仓库中的count <input type="number" :value="count" @input="changeCount"/>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data () {
    return {

    }
  },
  methods: {
    changeCount (e) {
      // 拿到输入框的值
      console.log(e.target.value)

      // 提交mutation,调用mutation函数
      this.$store.commit('changeCount', parseInt(e.target.value))
    }
  },
  computed: {
    ...mapState(['count', 'title'])
  }
}
</script>

<style>

</style>
